package com.bwie.controller;

import com.bwie.domain.ShopCar;
import com.bwie.domain.TOrder;
import com.bwie.service.ShopCarService;
import com.bwie.service.TOrderService;
import com.bwie.service.TProductService;
import com.bwie.service.TUservice;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @Description
 * @Author 36167
 * @Date 2025/3/12 9:52
 **/


@RestController
@RequestMapping("/prod")
public class ProdController {

    @Autowired
    private TProductService tProductService;

    @Autowired
    private ShopCarService shopCarService;

    @Autowired
    private TOrderService tOrderService;

    @Autowired
    private TUservice tUservice;


    @GetMapping("/prodlist")
    public R prodlist(PageInfoVo pageInfoVo){
        return tProductService.prodlist(pageInfoVo);
    }

    @PostMapping("/shopadd")
    public R shopadd(@RequestBody ShopCar shopCar){
        return shopCarService.shopadd(shopCar);
    }

    @PostMapping("/orderadd")
    public R orderadd(@RequestBody TOrder tOrder){
        return tOrderService.orderadd(tOrder);
    }

    @GetMapping("/shopcarlist")
    public R shopcarlist(){
        return shopCarService.shopcarlist();
    }


    @PostMapping("/user/{uid}")
    public R user(@PathVariable Integer uid){
        return tUservice.user(uid);
    }
}
